package cz.myslivec.slovicka.xml.converter;

import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Name;

import cz.myslivec.slovicka.entity.VocableType;
import cz.myslivec.slovicka.util.converter.AConverterBase;
import cz.myslivec.slovicka.xml.model.VocableTypeDTO;

@Name("vocableTypeConverter")
@AutoCreate
public class VocableTypeConverter extends AConverterBase<VocableType, VocableTypeDTO> {

	public VocableTypeConverter() {
		super();
	}

	@Override
	protected VocableTypeDTO getTo(VocableTypeDTO result, VocableType from) {
		result.setCode(from.getCode());
		result.setDescription(from.getDescription());
		result.setStr1(from.getStr1());
		result.setStr2(from.getStr2());
		result.setStr3(from.getStr3());
		result.setStr4(from.getStr4());
		return result;
	}

	@Override
	protected VocableType getFrom(VocableType result, VocableTypeDTO to) {
		result.setCode(to.getCode());
		result.setDescription(to.getDescription());
		result.setStr1(to.getStr1());
		result.setStr2(to.getStr2());
		result.setStr3(to.getStr3());
		result.setStr4(to.getStr4());
		return result;
	}

	@Override
	protected VocableTypeDTO getToInstance() {
		return new VocableTypeDTO();
	}

	@Override
	protected VocableType getFromInstance() {
		return new VocableType();
	}
}
